package com.ruoyi.service.tourism.impl;

import com.ruoyi.mapper.tourism.EcologicalParkMapper;
import com.ruoyi.service.tourism.EcologicalParkService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;
import java.util.UUID;

/**
 * @author zeo
 * @explain 生态园模块
 * @date 2021/2/2 17:16
 */
@Service
public class EcologicalParkServiceImpl implements EcologicalParkService {

    @Autowired
    EcologicalParkMapper ecologicalParkMapper;


    @Override
    public List<Map<String, Object>> findEcologicalParkMonthList(Map map) {
        return ecologicalParkMapper.findEcologicalParkMonthList(map);
    }

    @Override
    public List<Map<String, Object>> findEcologicalParkDayList(Map map) {
        return ecologicalParkMapper.findEcologicalParkDayList(map);
    }

    @Override
    public int addEcologicalPark(Map map) {
        String uuid = UUID.randomUUID().toString().trim().replaceAll("-", "");
        map.put("foreignId", uuid);
        ecologicalParkMapper.addShare(map);
        return ecologicalParkMapper.addEcologicalPark(map);
    }

    @Override
    public Map findEcologicalParkById(String id) {
        return ecologicalParkMapper.findEcologicalParkById(id);
    }

    @Override
    public int editEcologicalPark(Map map) {
        return ecologicalParkMapper.editEcologicalPark(map) + ecologicalParkMapper.editShare(map);
    }

    @Override
    public Map getLastDayData(Map map) {
        return ecologicalParkMapper.getLastDayData(map);
    }
}
